class Solution {
        public int countSegments(String s) {
            String trimmed = s.trim();
            if (trimmed.equals("")) {
                return 0;
            }
            return trimmed.split("\\s+").length;
        }
    }




public class Main {
    public static void main(String[] args) {

        Solution solution = new Solution();
        solution.countSegments("");

    }
}